<?php
/**
 * Created by PhpStorm.
 * User: 87976
 * Date: 2018/1/30
 * Time: 14:01
 */

namespace SDXApi\Service;



use SDXApi\Model\AdModel;

/**
 * Class HomeAdService
 * @package SDXApi\Service
 */
class HomeAdService
{

    /**
     * @var AdModel
     */
    protected $adModel;

    /**
     * HomeAdService constructor.
     */
    public function __construct()
    {
        $this->adModel = new AdModel();
    }

    /**
     * @author Jerry
     * @return array|mixed
     */
    public function getHomeAd()
    {
        $ad = $this->adModel->getCategoryAds(324);

        if (empty($ad)) {
            return array();
        }

        $ad['ad_code'] = 'https://w.shidexian.com/data/attached/afficheimg/' . $ad['ad_code'];

        $data = array(
            'ad_data'   =>  $ad,
        );

        return $data;
    }
}